# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=mautrix-whatsapp
pkgver=0.5.0
pkgrel=0
pkgdesc="A Matrix-WhatsApp puppeting bridge"
url="https://maunium.net/go/mautrix-whatsapp"
arch="all !s390x"
license="AGPL-3.0-or-later"
makedepends="go olm-dev"
install="$pkgname.pre-install $pkgname.pre-upgrade"
subpackages="$pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/mautrix/whatsapp/archive/v$pkgver.tar.gz
	mautrix-whatsapp.initd
	mautrix-whatsapp.confd
	default-log-dir.patch
	"
builddir="$srcdir"/whatsapp-$pkgver

build() {
	go build
}

check() {
	go test -v ./...
}

package() {
	install -Dm755 mautrix-whatsapp "$pkgdir"/usr/bin/mautrix-whatsapp
	install -Dm644 example-config.yaml "$pkgdir"/etc/mautrix-whatsapp/example-config.yaml
	install -Dm755 "$srcdir"/mautrix-whatsapp.initd "$pkgdir"/etc/init.d/mautrix-whatsapp
	install -Dm644 "$srcdir"/mautrix-whatsapp.confd "$pkgdir"/etc/conf.d/mautrix-whatsapp
}

sha512sums="9d2ceda176fcd092e66d5cb4339c140012000458b8f2004893696514efc548840449540de719d54f9fb81104b6b2da72deda706cd239c83e63917b08f303592d  mautrix-whatsapp-0.5.0.tar.gz
c735950faace99380a5cfd998ede482108381fcb48bdcd2405d32a4a84e12b2ee75995c3c12160d257479612dcd0ea4c773d4d7b6bef6f6bbbd0373f31f20acd  mautrix-whatsapp.initd
9349b660273c63d2973f1b99ddbd98469dddc098157380603210159f17d3cb1eb55e71dbd21550b20d40831f4da320225e7c03441667e2750e30a2e1fa03acfe  mautrix-whatsapp.confd
5642900e35028d4a0918ed9fd73f6dee402d895dff53423aa32f728703a01492d5aba64ec63984e2929d4630e43f7ed35bec71039fb4b8051703c421f38013da  default-log-dir.patch"
